#include("../../comm/ListHead.html")
<div class="layui-fluid" style="padding-top:20px">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-header"><i class="layui-icon layui-icon-slider"></i> 当前位置 > 修改个人信息</div>
                <div class="layui-card-body" pad15>
                    <form action="" class="layui-form" lay-filter="form">
                        #(token)
                        <input type="hidden" name="actions" value="#(form.actions)">
                        <input type="hidden" name="emp_id" value="#(user.emp_id)">

                        <div class="layui-row layui-col-space15">
                            <div class="layui-col-md12">
                                <div class="layui-form-item">
                                    <label class="layui-form-label">所属部门</label>

                                    <div class="layui-input-inline" style="width: 300px">
                                        <input type="text" value='#(form.select.get("deptid"))' class="layui-input input-readonly">

                                    </div>
                                    <div class="layui-form-mid layui-word-aux">
                                        如需修改，请联系管理员
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="layui-row">
                            <div class="layui-col-md12">
                                <div class="layui-form-item">
                                    <label class="layui-form-label">登陆帐号</label>

                                    <div class="layui-input-inline" style="width: 300px">
                                        <input type="text" name="login_id" placeholder="请输入帐号" lay-affix="clear"
                                               lay-verify="login_id" value="#(user.login_id)" class="layui-input">
                                    </div>
                                    <div class="layui-form-mid layui-word-aux">
                                        4-10个大小写字母或数字
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="layui-row">
                            <div class="layui-col-md12">
                                <div class="layui-form-item">
                                    <label class="layui-form-label">用户姓名</label>

                                    <div class="layui-input-inline layui-input-wrap" style="width: 300px">
                                        <div class="layui-input-prefix"><i class="layui-icon layui-icon-username"></i></div>
                                        <input type="text" name="user_name" placeholder="请输入姓名" lay-verify="required"
                                               lay-affix="clear" value="#(user.user_name)" class="layui-input">
                                    </div>
                                    <div class="layui-form-mid layui-word-aux">
                                        2-6个汉字
                                    </div>
                                </div>
                            </div>
                        </div>

                        <div class="layui-row">
                            <div class="layui-col-md12">
                                <div class="layui-form-item">
                                    <label class="layui-form-label">邮箱</label>

                                    <div class="layui-input-inline layui-input-wrap" style="width: 300px">
                                        <div class="layui-input-prefix"><i class="layui-icon layui-icon-email"></i></div>
                                        <input type="text" name="user_email" placeholder="请输入邮箱"
                                               lay-verify="email" lay-affix="clear" value="#(user.user_email)" class="layui-input">
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="layui-row">
                            <div class="layui-col-md12">
                                <div class="layui-form-item">
                                    <label class="layui-form-label">手机号</label>

                                    <div class="layui-input-inline layui-input-wrap" style="width: 300px">
                                        <div class="layui-input-prefix"><i class="layui-icon layui-icon-cellphone-fine"></i></div>
                                        <input type="text" name="user_phone" placeholder="请输入手机号" lay-verify="phone"
                                               lay-affix="clear"
                                               value="#(user.user_phone)" class="layui-input">
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="layui-row">
                            <div class="layui-col-md12">
                                <div class="layui-form-item">
                                    <label class="layui-form-label">微信绑定</label>

                                    <div class="layui-input-inline layui-input-wrap" style="width: 300px">
                                        <div class="layui-input-prefix"><i class="layui-icon layui-icon-login-wechat"></i></div>

                                        <input type="text" id="wx_openid" name="wx_openid" readonly value="#(user.wx_openid)" class="layui-input input-readonly">
                                    </div>
                                    <div class="layui-form-mid layui-word-aux">
                                        <button type="button" class="layui-btn layui-btn-xs btn-change-11" lay-event="BindWx">绑定</button>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <div class="layui-input-block">
                                <button type="submit" class="layui-btn" lay-submit="" lay-filter="Submit1">立即提交</button>
                                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
<SCRIPT LANGUAGE="JavaScript">
    <!--
    layui.use(['form', 'myTool'], function () {
        var form = layui.form, $ = layui.$;

        form.on('submit(Submit1)', function (data) {
            var index = layer.load();
            layui.myTool.post("ModifyMyInfoApi", {postdata: JSON.stringify(data.field)}, function () {
                layer.closeAll();
            });
            return false;
        });

        /**
         * 按钮事件
         */
        var _time, index, uuid;
        layui.util.event("lay-event", {
            BindWx: function () {
                clearInterval(_time);
                _time = setInterval(function () {
                    layui.$.get("getBindWxStatusApi", {wx_uuid: uuid}, function (res) {
                        if (res.code == 9) {
                            $("#wx_openid").val(res.msg);
                            clearInterval(_time);
                            top.layer.msg("绑定成功");
                            top.layer.close(index)
                        }
                    });
                }, 1000);

                layui.$.get("BindWxAccountApi", function (res) {
                    uuid = res.keystring;
                    index = top.layer.open({
                        type: 2, offset: '20%', area: ['430px', '460px'], title: ['请用微信扫码绑定帐号', 'font-size:15px;'],
                        content: [res.msg, 'no'],
                        end: function () {
                        }
                    });
                });
            }
        });


        //较验监督方
        form.verify({
            dept_id: function (value, item) {
                if (value == '') {
                    return '请选择部门';
                }
            },
            login_id: function (value, item) {
                if (value == '') {
                    return '请输入登陆帐号';
                } else {
                    var checkResult = "";
                    $.ajax({
                        type: 'GET',
                        url: "CheckLoginidApi",
                        async: false,
                        data: {login_id: value, emp_id: '#(user.emp_id)'},
                        success: function (results) {
                            if (results.code == 9) {
                                checkResult = "登陆帐号已存在";
                            }
                        },
                        error: function (return_data) {
                        },
                        dataType: "json"
                    });
                    return checkResult;
                }
            }
        });
    });
    //-->
</SCRIPT>
</body>
</html>